import { singleton } from "tsyringe";
import { RobotAppPage } from "../../page";
import { $ } from "../../../utils";
@singleton()
export class KwaiYodaWebViewActivity extends RobotAppPage {
    /**
     * 退出直播间
     */
    title: string = ``
    private isRuning: boolean = false;
    dispose(): void {
        this.out()
    }
    is(packageName: string): boolean {
        return `com.smile.gifmaker` === packageName || `com.kuaishou.nebula` === packageName;
    }
    accept(activityName: string): boolean {
        return `com.yxcorp.gifshow.webview.KwaiYodaWebViewActivity` === activityName;
    }
    in(): boolean {
        if (this.isRuning) return;
        this.isRuning = true;
        log(`KwaiYodaWebViewActivity in`)
        const node = textContains('我知道了').visibleToUser(true).findOnce()
        if (node) {
            $.clickButton(node)
        }
        return true;
    }
    out(): boolean {
        if (!this.isRuning) return false;
        this.isRuning = false;
        log(`KwaiYodaWebViewActivity Out`)
        return true;
    }
}